package controllers

import (
	"github.com/astaxie/beego"
	"strconv"
)

//图文上传
type FileController struct {
	beego.Controller
}

func (c *FileController)Get() {

	var httppath string = c.Ctx.Input.Site() + ":" + strconv.Itoa(c.Ctx.Input.Port())

	file3 := File2{Filename:"uploaded_file.png", Filesize: 0, Filetype:"", Has_file:true, Is_dir:false, Is_photo:true, Datetime: "2016-12-15 20:18:26"}

	Files := &FileList{Current_dir_path:httppath, Current_url:"/static/", Moveup_dir_path: "", Total_count:1, File_list:[]File2{file3}}

	c.Data["json"] = &Files

	c.ServeJSON()
}

type FileList struct {
	Current_dir_path string  `json:"current_dir_path"`
	Current_url      string `json:"current_url"`
	Moveup_dir_path  string `json:"moveup_dir_path"`
	Total_count      int64 `json:"total_count"`
	File_list        []File2 `json:"file_list"`
}

type File2 struct {
	Filename string `json:"filename"`
	Filesize int64 `json:"filesize"`
	Filetype string `json:"Filetype"`
	Has_file bool `json:"has_file"`
	Is_dir   bool `json:"is_dir"`
	Is_photo bool `json:"is_photo"`
	Datetime string`json:"datetime"`
}